STEP 3: Five astronauts are stranded! We'll use a loop to repeat one set of commands to create all five astronauts.

We'll also create a random integer in the loop. Each time the loop runs, it creates a new random x-coordinate!

  • In LOGIC, go to and drag Loop with Range into your program.
  • Go to and drop Random Integer inside the loop, so that it has a purple block ··· in front of it.
  • Name the integer rand_x. Change the range of rand_x to select a number between -230 and 230.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)